<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="http://code.jquery.com/jquery-1.12.4.js"></script>
    <script type="text/javascript" src="./accordion.js"></script>
    <title>accordion-demo</title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        #accordion1 {
            width: 1200px;
            height: 500px;
            position: absolute;
            left:50%;
            transform: translateX(-50%);
            margin-top:25px;
        }

        #accordion2 {
            width: 1000px;
            height: 800px;
            position: absolute;
            left:50%;
            transform: translateX(-50%);
            margin-top:550px;
        }
        h3{
            position: absolute;
            left:50%;
            transform: translateX(-50%)
        }
        h4{
            position: absolute;
            left:50%;
            transform: translateX(-50%);
            margin-top: 525px
        }
    </style>
</head>

<body>
    <h3>accordion X轴展开</h3>
    <div id="accordion1"></div>
    <h4>accordion Y轴展开</h4>
    <div id="accordion2"></div>
    <script type="text/javascript">
        let imgs = ['./img/1.jpg', './img/2.jpg', './img/3.jpg', './img/4.jpg', './img/5.jpg',]
        $(function () {
            let accordion2 = $('#accordion2')
            let accordion3 = $('#accordion3')
            new Accordion({
                el: accordion1, // 接管的元素
                imgs: imgs, // 图片src组
                imgOpen: 'X', //展开方式 X轴方向
            })
            new Accordion({
                el: accordion2,
                imgs: imgs,
                imgOpen: 'Y', //展开方式 Y轴方向
            })
        })
    </script>
</body>

</html>